<?php
/*
 * MYSQL CLASS
 * @autor	Albert Moreno Vendrell
 */
class Mysql extends Core {
    private $link;
    private $stmt;
    private $array;

	public function __construct(){
    	
  	}

    /*
     * Make the connection to the database.
     * @autor                           Albert Moreno Vendrell
     */
    private function connect(){
        $this->link 	= mysql_connect($this->server, $this->user, $this->password);
        if($this->link){
            mysql_select_db($this->data_base,$this->link);
            @mysql_query("SET NAMES 'utf8'");
        }

        return $this->link;
    }

    /*
     * Method to execute a SQL statement
     * @autor                           Albert Moreno Vendrell
     */
    public function execute($sql){
        $this->stmt     = mysql_query($sql,$this->link);

        return $this->stmt;
    }

	/*
	 * Returns the last insert id introduced
	 * @autor                           Albert Moreno Vendrell
	 */
	public function lastID(){
		return mysql_insert_id($this->link);
	}
}